import os

def delete_folder(path):
    if not os.path.exists(path):
        print("文件夹"+path.strip(r".\ ")+"不存在！")
        return

    for item in os.listdir(path):
        item_path = os.path.join(path, item)
        if os.path.isdir(item_path):
            delete_folder(item_path)
        else:
            os.remove(item_path)  # 删除文件

    os.rmdir(path)  # 删除文件夹

    print("文件夹"+path.strip(r".\ ")+"已成功删除！")

delete_folder(r".\day01")


"""
- os.path.exists()
- os.listdir()
- os.path.isdir()
- os.remove()
- os.rmdir()


- os.path.join()
- os.path.basename()
- os.path.dirname()

"""
